package phone.secure.power.cleaner.com.ui.widget

import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.view.animation.AnimationUtils
import android.widget.FrameLayout
import android.widget.LinearLayout
import com.id.supaclean.R

class FooterView(context: Context?, attrs: AttributeSet?) : LinearLayout(context, attrs) {

    private val normalLayout: LinearLayout
    val errorLayout: LinearLayout
    private val clearFocusOn: FrameLayout

    //    private val message: TextView
    private val await: LinearLayout

    init {
        inflate(context, R.layout.item_focus_on_footer, this)
        normalLayout = findViewById(R.id.normalLayout)
        errorLayout = findViewById(R.id.errorLayout)
        clearFocusOn = findViewById(R.id.clearFocusOn)
//        message = findViewById(R.id.message)
        await = findViewById(R.id.await)
    }

    fun attractAttention() {
        normalLayout.visibility = View.GONE
        errorLayout.visibility = View.VISIBLE

        AnimationUtils.loadAnimation(context, R.anim.scale_fast).apply {
            clearFocusOn.startAnimation(this)
        }
    }

    fun startClear() {
        clearFocusOn.clearAnimation()
        clearFocusOn.visibility = View.GONE
        await.visibility = View.VISIBLE
    }

}